package com.example.utils.config;

import javax.xml.ws.Endpoint;

import org.apache.cxf.Bus;
import org.apache.cxf.bus.spring.SpringBus;
import org.apache.cxf.jaxws.EndpointImpl;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.example.service.DHWebService;
import com.example.service.impl.DHWebServiceImp;

/**
 * 读取项目相关配置
 * 
 * @author lit
 */
@Configuration
public class CxfConfig {

	@Bean(name = Bus.DEFAULT_BUS_ID)
	public SpringBus springBus() {
		return new SpringBus();
	}

	@Bean
	public DHWebService appService() {
		return new DHWebServiceImp();
	}

	@Bean
	public Endpoint endpoint() {
		EndpointImpl endpoint = new EndpointImpl(springBus(), appService());
//		endpoint.getInInterceptors().add(new AuthInterceptor());// 添加校验拦截器
		endpoint.publish("/dh");
		return endpoint;
	}
}
